/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package aspect.example;
import aspect.entity.Entity;
import aspect.entity.behavior.Behavior;
import aspect.physics.Time;
import aspect.render.Billboard;
import aspect.render.Material;
import aspect.render.Mesh;
import aspect.render.ViewModel;
import aspect.util.Vector3;
import static aspect.resources.Resources.*;
import aspect.util.Color;
/**
*
* @author MillerV
*/
public class Explosion extends Entity {
private ViewModel model;
public Explosion(Vector3 pos) {
Material m = new Material();
m.emissive = Color.YELLOW;
model = ellipse(m, 1.0f, 1.0f, 20);
addBehavior(new Billboard(model));
transform.position = pos;
model.transform.scale = new Vector3(0.0f);
addBehavior(new Behavior() {
@Override
public void update() {
model.transform.scale.x += 8.0f * Time.deltaTime();
model.transform.scale.y += 8.0f * Time.deltaTime();
model.transform.scale.z += 8.0f * Time.deltaTime();
if (model.transform.scale.x > 2) {
Explosion.this.destroy();
((Mesh) model).destroy();
}
}
});
}
}